/**
 * 高级柯里化
 *   任意数量参数柯里化转换
 */
function sum(a,b,c){
    return a + b + c
}
/**
 * 函数递归
 *
 * @param {*} func 
 * @returns 
 */
function curry(func){
    return function curried(...args){
        if(args.length >= func.length){
            return func.apply(this,args)
        }else{
            return function(...args2){
                return curried.apply(this,args.concat(args2))
            }
        }
    }
}
const f = curry(sum)
let s = f(1)(2,3)
let s1 = f(1)(2)(3)

console.log('s ',s)